//
//  UIBarButtonItem.swift
//  微博项目
//
//  Created by admin on 16/3/2.
//  Copyright © 2016年 jin. All rights reserved.
//

import UIKit

extension UIBarButtonItem
{
    convenience init(image:UIImage,hilightedImage:UIImage,target: AnyObject?,action: Selector) {
        let tempButton = UIButton(type: UIButtonType.Custom)
        tempButton.setBackgroundImage(image, forState: UIControlState.Normal)
        tempButton.setBackgroundImage(hilightedImage, forState: UIControlState.Highlighted)
        tempButton.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchDown)
        tempButton.sizeToFit()
        self.init(customView: tempButton)
    }
}
